package com.ivi.car.module.maintain.view.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.ivi.car.module.maintain.view.fragment.PlanFragment;
import com.ivi.car.module.maintain.view.fragment.OrderFragment;

/**
 * Created by zhaolong.han on 2018/3/7.
 */
public class MaintainCarAdapter extends FragmentPagerAdapter {
  private FragmentManager mFragmentManager;
  private String[] mTitles;

  private int mCount = 2;

  public MaintainCarAdapter(FragmentManager fm, String[] title) {
    super(fm);
    this.mFragmentManager = fm;
    this.mTitles = title;
  }

  @Override
  public Fragment getItem(int position) {
    if (position == 0) {
      return PlanFragment.newInstance();
    } else {
      return OrderFragment.newInstance();
    }
  }

  @Override
  public int getCount() {
    return mCount;
  }

  @Override
  public CharSequence getPageTitle(int position) {
    return mTitles[position];
  }
}

